import { get, post, formSubmit, formUrlencoded } from "./request";
import { Cookie,getUrlParam } from "@/utils";
import http from "./axios.js";
import { decrypt } from "@/utils/encryption.js"
const makeGet =
  (path, interfaceType) =>
  (params = {}) =>
    get(path, params, interfaceType);
const makePost =
  (path, interfaceType) =>
  (params = {}) =>
    post(path, params, interfaceType);
const makeFormSubmit =
  (path, interfaceType) =>
  (params = {}) =>
    formSubmit(path, params, interfaceType);
const makeFormUrlencoded =
  (path, interfaceType) =>
  (params = {}) =>
    formUrlencoded(path, params, interfaceType);
import dayjs from "dayjs";
//法律政策库认证
export const legalCertification = () => {
  return http({
    url: "/lawMoa/loginVerify",
    params: {
      uuid: dayjs().valueOf(),
      mx_sso_token: getUrlParam("mx_sso_token") || localStorage.getItem("mx_sso_token"),
    },
  });
};
//最短路径查关系
export const getCheckRelation = (value) => {
  return http({
    method:"post",
    url: "/inquire/shortPath/v2",
    baseURL: decrypt(process.env.VUE_APP_SKY_API_HOST),
    data: value,
    headers: {
      "Content-Type": "application/x-www-form-urlencoded",
       accessToken: Cookie.getCookie("accessToken") || "",
    },
  });
};
//法律政策库列表
export const lawList = (value) => {
  return http({
    method: "post",
    url: `/lawMoa/getLegalPolicyList?uuid=${dayjs().valueOf()}`,
    data: value,
  });
};
//法律政策库详情
export const particulars = (value) => {
  return http({
    method: "get",
    url: `/lawMoa/getLegalPolicyDetail?uuid=${dayjs().valueOf()}`,
    params: { id: value },
  });
};
//经营许可资质列表
export const getBusinessLicenseList = (value) => {
  return http({
    method: "post",
    url: `/lawMoa/getBusinessLicenseList?uuid=${dayjs().valueOf()}`,
    data: value,
  });
};
//经营许可资质详情
export const getBusinessLicenseDetail = (value) => {
  return http({
    method: "get",
    url: `/lawMoa/getBusinessLicenseDetail?uuid=${dayjs().valueOf()}`,
    params: { id: value },
  });
};
//机器人信息获取
export const getRobotInfo = makeGet("/api/getRobotInfo.htm");

//人员信息获取
export const getUserInfo = makeGet("/api/getUserInfo.htm");

//搜索问答,机器人问答
export const getTalkAnswers = makeFormUrlencoded("/api/getTalkAnswers.htm", "law");

//获取预设关键字
export const getPresetKeyWordsTypes = makeGet("/api/getPresetKeyWordsTypes.htm");

//提交意见建议
export const addOptimizeAdvise = makeFormUrlencoded("/api/addOptimizeAdvise.htm", "law");

//法律服务
export const getLegalServe = makeGet("/api/getLegalServe.htm");

//获取与我关联的岗位的风险点
export const getMineRelationQueName = makeGet("/api/findMineRelationQueName.htm");

//法律审核文字类型审核
export const textReview = makeFormSubmit("/api/textReview");

//法律审核文字识别
export const readTextFromImg = makeFormSubmit("/api/readTextFromImg");

//获取法律审核结果
export const getExamineResult = makeFormSubmit("/api/getIssueDetail");

//获取资信核查token
export const getAccessToken = makeGet("/moasso", "sky");

//搜索资信信息
export const getQueryCredit = makeFormUrlencoded("/inquire/search/v1");

//获取基本信息
export const getEnterpriseInfo = makeFormUrlencoded("/inquire/enterprise_info/v1");

//获取股东信息
export const getShareholderInfo = makeFormUrlencoded("/inquire/holder/v1");

//获取经营信息-电信许可
export const getTelecomLicense = makeFormUrlencoded("/inquire/telecom_license/v1");

//获取资质证书
export const getCertificate = makeFormUrlencoded("/inquire/certificate/v1");

//获取对外投资信息
export const getInvestInfo = makeFormUrlencoded("/inquire/invest/v1");

//获取分支机构信息
export const getBranchInfo = makeFormUrlencoded("/inquire/branch/v1");

//获取总公司信息
export const getParentCompany = makeFormUrlencoded("/inquire/parent_company/v1");

//获取风险信息
export const getRiskInfo = makeFormUrlencoded("/inquire/risk_info/v1");

//获取风险详情信息
export const getRiskDetailInfo = makeFormUrlencoded("/inquire/risk_detail/v1");

//获取司法协助历史信息
export const getRiskJudicialInfo = makeFormUrlencoded("/inquire/judicial/v1");

//获取商业角色信息
export const getRolesInfo = makeFormUrlencoded("/inquire/roles/v1");

//获取基本信息变更记录
export const getChangeInfo = makeFormUrlencoded("/inquire/changeinfo/v2");

//获取招投标信息
export const getBiddingInformation = makeFormUrlencoded("/inquire/bids/v1");
